import {
    queryResponseDataOnDatasets,queryonUpdateDataFrom
} from "./onUpdateDataUtils.js"
import {_onUpdateDatas} from "./onUpdateDataUtils_testdata.js"

const datasets = [{
    //"name": "商品区域销售",
    name:"test1"
}]
const params = [
    {
        "name": "商品",
        "value": ["笔记本电脑", "台式电脑"]
    },
    {
        "name": "区域名称",
        "value": ["北京", "上海"]
    },
    {
        "name": "年份",
        "value": ["2020", "2021"]
    },
    {
        "name": "季度",
        "value": ["1", "2", "3", "4"]
    }
]

const params2 = [
    {
        "name": "商品",
        "value": ["笔记本电脑"]
    },
    {
        "name": "区域名称",
        "value": ["北京"]
    },
    {
        "name": "年份",
        "value": ["2020"]
    },
    {
        "name": "季度",
        "value": ["1"]
    }
]
const params3 = [
    {
        "name": "商品",
        "value": ["PURA70"]
    },
    {
        "name": "区域名称",
        "value": ["杭州"]
    },
    {
        "name": "年份",
        "value": ["2021"]
    },
    {
        "name": "季度",
        "value": ["4"]
    }
]
const params4 = [{
  "test1.name":"test1.value",

}]

let testdata=
    [
        {
            "name": "工单",
            "type": 4,
            "response_data": [
                {
                    "工单单号": "普罗旺斯A-X-1",
                    "品号": "TF0301B",
                    "品名": "欧式水晶吊灯",
                    "检验员": "月球1号",
                    "车间主任": "嫦娥1号",
                    "财务": "火星1号"
                },
                {
                    "工单单号": "纳丹堡N-X-8",
                    "检验员": "月球2号",
                    "车间主任": "嫦娥2号",
                    "财务": "火星2号"
                }
            ]
        },
        {
            "name": "工单明细",
            "type": 4,
            "response_data": [
                {
                    "id": 1,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": "东邪黄药师",
                    "报工时间": "2023-01-01",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 10,
                    "合格数量": 9,
                    "不合格数量": 1,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 1,
                    "料废": 1
                },
                {
                    "id": 2,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": "东邪黄药师",
                    "报工时间": "2023-01-02",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 3,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": "东邪黄药师",
                    "报工时间": "2023-01-03",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-03",
                    "订单状态": "正常",
                    "小计": 10,
                    "合格数量": 9,
                    "不合格数量": 1,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 1,
                    "料废": 1
                },
                {
                    "id": 4,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": "东邪黄药师",
                    "报工时间": "2023-01-06",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-06",
                    "订单状态": "正常",
                    "小计": 10,
                    "合格数量": 9,
                    "不合格数量": 1,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 1,
                    "料废": 1
                },
                {
                    "id": 5,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": "东邪黄药师",
                    "报工时间": "2023-01-07",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 10,
                    "合格数量": 9,
                    "不合格数量": 1,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 1,
                    "料废": 1
                },
                {
                    "id": 6,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": "东邪黄药师",
                    "报工时间": "2023-01-08",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 10,
                    "合格数量": 9,
                    "不合格数量": 1,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 1,
                    "料废": 1
                },
                {
                    "id": 7,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": "西 毒 欧 阳 锋",
                    "报工时间": "2023-01-02",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 8,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": "西 毒 欧 阳 锋",
                    "报工时间": "2023-01-03",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 9,
                    "工艺名称": "20 车 一 道",
                    "报工人": "西 毒 欧 阳 锋",
                    "报工时间": "2023-01-04",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 10,
                    "工艺名称": "20 车 一 道",
                    "报工人": "西 毒 欧 阳 锋",
                    "报工时间": "2023-01-05",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 11,
                    "工艺名称": "20 车 一 道",
                    "报工人": "西 毒 欧 阳 锋",
                    "报工时间": "2023-01-06",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 1,
                    "合格数量": 6,
                    "不合格数量": 5,
                    "工价": 1,
                    "计划数量": 1,
                    "工废": 1,
                    "料废": 0
                },
                {
                    "id": 12,
                    "工艺名称": "20 车 一 道",
                    "报工人": "西 毒 欧 阳 锋",
                    "报工时间": "2023-01-07",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 13,
                    "工艺名称": "20 车 一 道",
                    "报工人": "西 毒 欧 阳 锋",
                    "报工时间": "2023-01-08",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 14,
                    "工艺名称": "30 清 洗",
                    "报工人": "西 毒 欧 阳 锋",
                    "报工时间": "2023-01-09",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 15,
                    "工艺名称": "30 清 洗",
                    "报工人": "西 毒 欧 阳 锋",
                    "报工时间": "2023-01-10",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 16,
                    "工艺名称": "30 清 洗",
                    "报工人": "西 毒 欧 阳 锋",
                    "报工时间": "2023-01-11",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 17,
                    "工艺名称": "30 清 洗",
                    "报工人": "西 毒 欧 阳 锋",
                    "报工时间": "2023-01-12",
                    "工单单号": "普罗旺斯A-X-1",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 21,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": " 乔 峰 帮 主",
                    "报工时间": "2023-01-01",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 10,
                    "合格数量": 8,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 2
                },
                {
                    "id": 22,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": " 乔 峰 帮 主",
                    "报工时间": "2023-01-02",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 23,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": " 乔 峰 帮 主",
                    "报工时间": "2023-01-03",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-03",
                    "订单状态": "正常",
                    "小计": 10,
                    "合格数量": 9,
                    "不合格数量": 1,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 1,
                    "料废": 1
                },
                {
                    "id": 24,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": " 乔 峰 帮 主",
                    "报工时间": "2023-01-06",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-06",
                    "订单状态": "正常",
                    "小计": 10,
                    "合格数量": 9,
                    "不合格数量": 1,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 1,
                    "料废": 1
                },
                {
                    "id": 25,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": " 乔 峰 帮 主",
                    "报工时间": "2023-01-01",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 10,
                    "合格数量": 9,
                    "不合格数量": 1,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 1,
                    "料废": 1
                },
                {
                    "id": 26,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": " 乔 峰 帮 主",
                    "报工时间": "2023-01-03",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 10,
                    "合格数量": 9,
                    "不合格数量": 1,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 1,
                    "料废": 1
                },
                {
                    "id": 27,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": "大 理 段 誉 ",
                    "报工时间": "2023-01-02",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 28,
                    "工艺名称": "10 钻 孔 攻 丝",
                    "报工人": "大 理 段 誉 ",
                    "报工时间": "2023-01-03",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 29,
                    "工艺名称": "20 车 一 道",
                    "报工人": "大 理 段 誉 ",
                    "报工时间": "2023-01-04",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 30,
                    "工艺名称": "20 车 一 道",
                    "报工人": "大 理 段 誉 ",
                    "报工时间": "2023-01-05",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 31,
                    "工艺名称": "20 车 一 道",
                    "报工人": "大 理 段 誉 ",
                    "报工时间": "2023-01-06",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 1,
                    "合格数量": 6,
                    "不合格数量": 5,
                    "工价": 1,
                    "计划数量": 1,
                    "工废": 1,
                    "料废": 0
                },
                {
                    "id": 32,
                    "工艺名称": "20 车 一 道",
                    "报工人": "大 理 段 誉 ",
                    "报工时间": "2023-01-07",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 33,
                    "工艺名称": "20 车 一 道",
                    "报工人": "大 理 段 誉 ",
                    "报工时间": "2023-01-08",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 34,
                    "工艺名称": "30 清 洗",
                    "报工人": "大 理 段 誉 ",
                    "报工时间": "2023-01-09",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 35,
                    "工艺名称": "30 清 洗",
                    "报工人": "大 理 段 誉 ",
                    "报工时间": "2023-01-10",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 36,
                    "工艺名称": "30 清 洗",
                    "报工人": "大 理 段 誉 ",
                    "报工时间": "2023-01-11",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                },
                {
                    "id": 37,
                    "工艺名称": "30 清 洗",
                    "报工人": "大 理 段 誉 ",
                    "报工时间": "2023-01-12",
                    "工单单号": "纳丹堡N-X-8",
                    "最后报工时间": "2023-01-01",
                    "订单状态": "正常",
                    "小计": 20,
                    "合格数量": 18,
                    "不合格数量": 2,
                    "工价": 19,
                    "计划数量": 16,
                    "工废": 2,
                    "料废": 3
                }
            ]
        }
    ]
let params5=
    [
        {
            "name": "工单单号",
            "value": "普罗旺斯A-X-1"
        }
    ]
console.log(JSON.stringify(queryResponseDataOnDatasets(testdata,params5)))
